class Rectangle {

    constructor(height, width) {
        this.height = height;
        this.width = width;
    }

    get area() {
        return this.calcArea()
    }

    calcArea() {
        return this.height * this.width;
    }
}

const square = new Rectangle(10, 10);

console.log(square.area);


class Point {

    constructor(x, y) {
        this.x = x;
        this.y = y;

    }

    static displayName = "Point";

    static distance(a, b) {
        const dx = a.x - b.x;
        const dy = a.y - b.y;
        return Math.hypot(dx, dy);
    }
}

const p1 = new Point(5, 5);
const p2 = new Point(10, 10);
p1.displayName;

p1.distance;
// console.log(p1.displayName)
console.log(Point.displayName);
console.log(Point.distance(p1, p2));

class Animal {
    speak() {
        return this;
    }

    static eat() {
        return this;
    }
}

let obj = new Animal();
obj.speak();
let speak = obj.speak;
speak();

Animal.eat();
let eat = Animal.eat;
eat();


class Person {
    constructor(name) {
        this.name = name;
    }

    eat() {
        console.log("l like eat apple");
    }
}

class Boy extends Person {
    constructor(name) {
        super(name);
    }

    eat() {
        console.log(this.name + " like eat apple");
    }
}

var b = new Boy("mahu");
b.eat();